const Router = require("koa-router");
const { verifyToken } = require("../middeleware/auth.middleware");
const {
  getList0,
  getList1,
  addList,
  addGood,
  updateList,
  deleteList,
  getGoodlist,
  updategood,
  delgood,
} = require("../controller/goods.controller");

const { avatarInfo } = require("../controller/goods.controller");

const goodsRouter = new Router({ prefix: "/goods" });

goodsRouter.get("/getList0", verifyToken, getList0);
goodsRouter.get("/getList1", verifyToken, getList1);
// 参看商品头像
goodsRouter.get("/avatar/:goods_id", avatarInfo);
// 添加分类
goodsRouter.post("/addList", verifyToken, addList);
// 添加商品
goodsRouter.post("/addGood", verifyToken, addGood);
// 修改分类信息
goodsRouter.put("/updatelist", verifyToken, updateList);
// 删除分类
goodsRouter.delete("/dellist/:cat_id", verifyToken, deleteList);

// 获取商品列表 --- 0 级 + 1级
goodsRouter.get("/getGoodlist", verifyToken, getGoodlist);
// 修改商品
goodsRouter.put("/updategood", verifyToken, updategood);
// 删除商品
goodsRouter.delete("/delgood/:id", verifyToken, delgood);

module.exports = goodsRouter;
